import React from 'react';
import { connect } from 'react-redux'
import {withRouter } from 'react-router-dom'
import { UserMenu } from '../../redux/company/company'
import { Divider } from 'antd';
import PwdModel from './PwdModel'
@withRouter
@connect(
    state => state,
    {UserMenu}
)
export default class UserCompany extends React.Component {
    constructor(){
        super();
        this.state = {
            visible:false
        }
    }
    componentWillReceiveProps(nextProps){
          if(nextProps.company.pwdState){
            this.props.UserMenu();
            this.showModel();
          }
    }
    onpwd(){
      this.setState({
          visible:true
      })
    }
    showModel(){
        this.setState({
            visible:!this.state.visible
        })
    }

    componentDidMount(){
        this.props.UserMenu();
    }
    render() {
        let uesr = this.props.company.uesr
        return (
               
               !uesr ? '' :
               <div  style={{width:'80%',margin:'0 auto',overflow:'hidden',paddingBottom:50}}>
                    <div style={{fontSize:'20px',textAlign:'center',paddingTop:20,paddingBottom:10}}>个人信息详情</div>
                    <div>基本信息</div>
                    <Divider/>
                    <div style={{float:"left",width:'50%'}}>账号：{uesr.userName}</div>
                    <div style={{float:"left",width:'50%'}}>角色管理：{uesr.roleName}</div>
                    <div style={{color:'#1890ff',paddingBottom:10,paddingTop:'35px'}} onClick={this.onpwd.bind(this)}>点击修改密码</div>
                    
                    <PwdModel visible={this.state.visible} showModel={this.showModel.bind(this)}/>
                </div>
           
        );
    }
}